package cn.wolfcode.luowowo.util;

import cn.wolfcode.luowowo.exception.LogicException;
import org.springframework.lang.Nullable;
import org.springframework.util.StringUtils;

/**
 * 参数判断工具类
 */
public class AssertUtil {
    /**
     * 判断指定text是否有值
     * @param text
     * @param message
     */
    public static void hasLength(String text, String message) {
        if (!StringUtils.hasLength(text)) {
            throw new LogicException(message);
        }
    }

    public static void isEquals(String v1, String v2, String msg) {
        if (v1 == null | v2 == null) {
            throw new LogicException(msg);
        } else if (!v1.equals(v2)) {
            throw new LogicException(msg);
        }
    }
}
